package org.glorylight.hacks.social.model;

import java.io.Serializable;
import java.sql.Blob;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;


@Entity
@Table(name = "user")
public class User implements Serializable {
	
	private static final long serialVersionUID = 7840802631494387703L;

	@Id
	@Column(name = "email_address")
	private String emailAddress;

	@Column
	private Byte[] password;

	@Column(name = "name", nullable = false, length = 50)
	private String name;

	@Temporal(TemporalType.DATE)
	@Column(name = "birth_date")
	private Date birthDate;

	@Column(name = "gender", nullable = false, length = 25)
	private String gender;
	
	@Column(name = "mobile_no", nullable = false, length = 25)
	private String mobileNo;
	
	@Column(name = "timeline")
	private Blob timeline;
	
	@OneToMany(mappedBy = "user", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
	private List<UserNetwork> networks = new ArrayList<UserNetwork>();
	
	@Column(name = "babyName", length =50)
	private String babyName;
	
	@Temporal(TemporalType.DATE)
	@Column(name = "babyBirthDate")
	private Date babyBirthDaate;

	public User(){
		
	}
	public User(String emailAddress, Byte[] password, String name, Date birth, String gender, String mobileNo) {
		this.emailAddress = emailAddress;
		this.password = password;
		this.name = name;
		this.birthDate = birth;
		this.gender = gender;
		this.mobileNo = mobileNo;
	}
	
	public String getEmailAddress() {
		return emailAddress;
	}

	public void setEmailAddress(String emailAddress) {
		this.emailAddress = emailAddress;
	}

	public Byte[] getPassword() {
		return password;
	}

	public void setPassword(Byte[] password) {
		this.password = password;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Date getBirthDate() {
		return birthDate;
	}

	public void setBirthDate(Date birthDate) {
		this.birthDate = birthDate;
	}

	public String getGender() {
		return gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}

	public Blob getTimeline() {
		return timeline;
	}

	public void setTimeline(Blob timeline) {
		this.timeline = timeline;
	}

	public List<UserNetwork> getNetworks() {
		return networks;
	}

	public void setNetworks(List<UserNetwork> networks) {
		this.networks = networks;
	}

	public String getMobileNo() {
		return mobileNo;
	}

	public void setMobileNo(String mobileNo) {
		this.mobileNo = mobileNo;
	}
	public String getBabyName() {
		return babyName;
	}
	public void setBabyName(String babyName) {
		this.babyName = babyName;
	}
	public Date getBabyBirthDaate() {
		return babyBirthDaate;
	}
	public void setBabyBirthDaate(Date babyBirthDaate) {
		this.babyBirthDaate = babyBirthDaate;
	}
	
	
}
